//
//  StudyCourseFooterView.m
//  LovingPartyBuilding
//
//  Created by ZJ on 2017/5/3.
//  Copyright © 2017年 刘应平. All rights reserved.
//

#import "StudyCourseFooterView.h"


@implementation StudyCourseFooterView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor zj_colorWithHexString:@"ededed"];
        [self initUIWithButton];
    }
    return self;
}

- (void)initUIWithButton{
    CGFloat space = 1 * [UIScreen zj_screenWScale];
    CGFloat btWidth = (self.width - 4 * space) / 5;
    CGFloat btHeight = self.height - space;
    NSArray *titleArray = @[@" 收藏",@" 评价",@" 笔记",@" 提问",@" 学后感"];
    NSArray *imageName = @[@"mine_tab_ziyuan_d",@"learn_source_comment_d",@"learn_source_note_d",@"learn_source_question_d",@"learn_source_note_d"];
    for (int i = 0; i < 5; i ++) {
        UIButton *button = [[UIButton alloc]initWithFrame:CGRectMake((btWidth + space) * i, space, btWidth, btHeight)];
        [button setTitle:titleArray[i] forState:UIControlStateNormal];
        [button setTitleColor:[UIColor zj_colorWithHexString:@"b9babe"] forState:UIControlStateNormal];
        [button setImage:[UIImage imageNamed:imageName[i]] forState:UIControlStateNormal];
        button.tag = i;
        button.titleLabel.font = [UIFont systemFontOfSize:15];
        button.backgroundColor = [UIColor whiteColor];
        if (i == 0) {
            [button setTitle:@" 已收藏" forState:UIControlStateSelected];
            [button setTitleColor:[UIColor themeColor] forState:UIControlStateSelected];
            [button setImage:[UIImage imageNamed:@"mine_tab_ziyuan_h"] forState:UIControlStateSelected];
        }
        [button addTarget:self action:@selector(action_button:) forControlEvents:UIControlEventTouchUpInside];
        
        [self addSubview:button];
    }

}


#pragma mark - 点击事件
- (void)action_button:(UIButton *)sender{
    switch (sender.tag) {
        case 0://收藏
        {
        
        }
            break;
        case 1://评价
        {
            
        }
            break;
        case 2://笔记
        {
            
        }
            break;
        case 3://提问
        {
            
        }
            break;
        case 4://学后感
        {
            
        }
            break;
            
        default:
            break;
    }
    
}


@end
